home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / mr2i105.zip / MSGUTIL.ORG < prev    next >
Text File  |  1996-04-17  |  5KB  |  189 lines

  1. /*
  2.     MR/2 ICE - MSGUTIL.CMD
  3.  
  4.     Copyright (c) 1996, Nick Knight
  5.     All Rights Reserved.
  6.  
  7.     Author:     Nick Knight
  8.     Created:    03/03/96
  9.     Usage:        msgutil subcommand MessageFile
  10.     Purpose:    msgutil.cmd allows for special processing of message
  11.                 files.    It is called from within MR/2 ICE, passed a
  12.                 subcommand based on the Fkey used to invoke it (F1 == 1,
  13.                 F12 = 12) and the current message file name.
  14.     US Mail:    Nick Knight, PO Box 22366, Beachwood, Ohio 44122
  15.     Fidonet:    1:157/2 or 1:/157/200
  16.     Internet:    nick@secant.com
  17.     Compuserve: 76066,1240
  18.     BBS:        Private messages on Nerd's Nook (216) 356-1772 or 1872
  19.  
  20. ** Major Update: 04/16/96, gutted/rewritten using wonderful examples by:
  21.    
  22.    Author.........:  Jason Gottschalk, Internet: os2@tir.com
  23.    Date Written...:  March 15, 1996
  24.  
  25. */
  26.  
  27. /* USER SELECTABLE OPTIONS */
  28.  
  29. /* if set to 0, Ctrl-F1 will NOT attempt to load viewer */
  30. EnableMimeViewers = 1      
  31.  
  32. Editor = 'e'
  33. Browser = 'explore.exe'
  34. BitmapViewer = 'ib.exe'
  35. AviViewer = 'vb.exe'
  36. WavPlayer = 'ab.exe'
  37. INFViewer = 'view.exe'
  38. MPGViewer = 'pmmpeg.exe'
  39.  
  40.  
  41. Signal on Syntax        /* Setup event handlers */
  42. Signal on Halt
  43. Signal on Novalue
  44.                        
  45.                        /* Include OS/2 Rexx utilities */
  46.  
  47. if RxFuncQuery('SysLoadFuncs') then
  48.    do
  49.       call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  50.       call SysLoadFuncs
  51.    end
  52.  
  53.  
  54.                            /* Run through some standard setup */
  55.  
  56. '@echo off'               /* turn off display of OS/2 commands */
  57. crlf='0d0a'x              /* Set Carriage Return with LineFeed */
  58.  
  59. env = 'OS2ENVIRONMENT'    /* Access environment init variables */
  60.  
  61. parse value SysCurPos() with row col   /* Get current cursor position */
  62.  
  63. CMDLineArgs = translate(arg(1))        /* Snag everything from the command line */
  64.  
  65. esc  = '1b'x    /* ESC character */
  66. P = esc'[35m'   /* ANSI.SYS-control for purple foreground */
  67. r = esc'[31m'   /* ANSI.SYS-control for red foreground */
  68. g = esc'[32m'   /* ANSI.SYS-control for green foreground */
  69. y = esc'[33m'   /* ANSI.SYS-control for yellow foreground */
  70. cy = esc'[36m'  /* ANSI.SYS-control for cyan foreground */
  71. wh = esc'[0m'   /* ANSI.SYS-control for resetting attributes to normal */
  72. bl = esc'[5m'   /* ANSI.SYS-control for blinking */
  73. hl = esc'[1m'   /* ANSI.SYS-control for highlight */
  74.  
  75.  
  76. FKey = 0
  77.  
  78. parse value CMDLineArgs with FKey filename
  79.  
  80. select
  81.   when FKey = 1 then
  82.   do
  83.    'mkdir attached 2>nul'
  84.    'cd attached'
  85.    'munpack 'filename
  86.    'xbin 'filename
  87.     if (EnableMimeViewers = 1) then
  88.       do while Lines(Filename) > 0
  89.         InRec = LineIn(Filename)
  90.         If pos('FILENAME="',translate(InRec)) > 0 then
  91.           do
  92.             do while left(translate(InRec),10) <> 'FILENAME="'
  93.                InRec = strip(InRec,'L',left(InRec,1))
  94.             end
  95.             parse value InRec with file '"' DFile '"'
  96.             DFile = translate(DFile)
  97.             parse value DFile with Name '.' Ext
  98.             if ext = 'TXT' | ext = 'DOC' | ext = 'ME' then
  99.                 'start 'Editor' 'dfile
  100.             if ext = 'GIF' | ext = 'JPG' | ext = 'BMP' | ext = 'TIF' then
  101.                 'start 'BitmapViewer' 'dfile
  102.             if ext = 'MPG' then 'start 'MPGViewer' 'dfile
  103.             if ext = 'AVI' then 'start 'AviViewer' 'dfile
  104.             if ext = 'WAV' then 'start 'WavPlayer' 'dfile
  105.             if ext = 'INF' then 'start 'INFViewer' 'dfile
  106.             'cd..'
  107.             'exit'
  108.           end
  109.         end
  110.        'cd ..'
  111.   end
  112.   
  113.   when FKey = 2 then
  114.   do
  115.     'start 'Editor' 'filename
  116.   end
  117.  
  118.   when FKey = 3 then
  119.   do
  120.     call SysFileDelete('mail.htm')
  121.     'copy 'filename' mail.htm >12'
  122.     'start 'Browser' mail.htm'
  123.   end
  124.   
  125.   when FKey = 4 then
  126.   do
  127.     nop
  128.   end
  129.   
  130.   when FKey = 5 then
  131.   do
  132.     nop
  133.   end
  134.   when FKey = 6 then
  135.   do
  136.     nop
  137.   end
  138.   when FKey = 7 then
  139.   do
  140.     nop
  141.   end
  142.   when FKey = 8 then
  143.   do
  144.     nop
  145.   end
  146.   when FKey = 10 then
  147.   do
  148.     nop
  149.   end
  150.   when FKey = 11 then
  151.   do
  152.     nop
  153.   end
  154.   when FKey = 12 then
  155.   do
  156.     nop
  157.   end
  158.  
  159.   otherwise
  160.     say 'Invalid Function Key passed by MR/2: 'FKey
  161. end
  162.  
  163. exit
  164. Syntax:
  165.    Say 'A SYNTAX condition was raised on line' sigl'!'
  166.    Say '  The error number is' rc', which means "'Errortext(rc)'"'
  167.    problem_line = sigl
  168.    Signal Abnormal_End
  169.  
  170. Halt:
  171.    Say 'A Halt condition was raised on line' sigl'!'
  172.    problem_line = sigl
  173.    Signal Abnormal_End
  174.  
  175. Novalue:
  176.    Say 'Novalue Condition raised on line' sigl'!'
  177.    Say '  The variable which caused it is' Condition('Description')
  178.    problem_line = sigl
  179.    Signal Abnormal_End
  180.  
  181. Abnormal_End:
  182.    Say '  That line is "'Sourceline(problem_line)'"'
  183.    Say '  You can now debug if you want to.'
  184.    Trace ?R
  185.    Nop
  186.  
  187. Exit
  188.  
  189.